package io;

import ooday02.Fish;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class FOS {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        /*
        FileInputStream fis = new FileInputStream("osw.txt");
        InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
        int d;
        while ((d=isr.read())!=-1){
            System.out.println((char)d);
        }
        isr.close();
        FileInputStream fis1 = new FileInputStream("osw.txt");
        InputStreamReader isr1 = new InputStreamReader(fis, StandardCharsets.UTF_8);
        int d1;
        while ((d=isr.read())!=-1){
            System.out.println((char)d);
        }
        isr.close();

         */
        /*
        FileOutputStream fos = new FileOutputStream("osw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos,StandardCharsets.UTF_8);
        osw.write("和我在成都的街头走一走，哦哦哦哦哦");
        osw.write("直到所有的灯都熄灭了也不停留");
        System.out.println("写出完毕！");
        osw.close();

         */
        /*
        FileInputStream fis = new FileInputStream("student.obj");
        ObjectInputStream ois = new ObjectInputStream(fis);
        Object obj = ois.readObject();
        Students zs = (Students) obj;
        System.out.println(zs);
        ois.close();
         */
        /*
        String name = "赵四";
        int age = 27;
        String gender ="男";
        String[] otherInfo = {"是一个学生","黑空降佳木斯","喜欢打篮球","喜欢赌球"};
        Students zs = new Students(name,age,gender,otherInfo);
        System.out.println(zs);

        FileOutputStream fos = new FileOutputStream("students.odj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(zs);
        System.out.println("写出完毕！");
        oos.close();
        */
        /*
        FileInputStream fis = new FileInputStream("wkj.jpg");
        BufferedInputStream bis = new BufferedInputStream(fis);
        FileOutputStream fos = new FileOutputStream("wkj_cp2.jpg");
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        long start = System.currentTimeMillis();
        int b;
        while ((b=bis.read())!=-1){
            bos.write(b);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕!耗时："+(end-start)+"ms");
        bis.close();
        bos.close();
         */
         /*
        FileInputStream fis = new FileInputStream("osw.txt");
        InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
        int d;
        while ((d=isr.read())!=-1){
            System.out.println((char)d);
        }
        isr.close();
        FileInputStream fis1 = new FileInputStream("osw.txt");
        InputStreamReader isr1 = new InputStreamReader(fis, StandardCharsets.UTF_8);
        int d1;
        while ((d=isr.read())!=-1){
            System.out.println((char)d);
        }
        isr.close();

         */
        /*
        FileOutputStream fos = new FileOutputStream("osw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos,StandardCharsets.UTF_8);
        osw.write("和我在成都的街头走一走，哦哦哦哦哦");
        osw.write("直到所有的灯都熄灭了也不停留");
        System.out.println("写出完毕！");
        osw.close();

         */
        /*
        FileInputStream fis = new FileInputStream("student.obj");
        ObjectInputStream ois = new ObjectInputStream(fis);
        Object obj = ois.readObject();
        Students zs = (Students) obj;
        System.out.println(zs);
        ois.close();
         */
        /*
        String name = "赵四";
        int age = 27;
        String gender ="男";
        String[] otherInfo = {"是一个学生","黑空降佳木斯","喜欢打篮球","喜欢赌球"};
        Students zs = new Students(name,age,gender,otherInfo);
        System.out.println(zs);

        FileOutputStream fos = new FileOutputStream("students.odj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(zs);
        System.out.println("写出完毕！");
        oos.close();
        */
        /*
        FileInputStream fis = new FileInputStream("wkj.jpg");
        BufferedInputStream bis = new BufferedInputStream(fis);
        FileOutputStream fos = new FileOutputStream("wkj_cp2.jpg");
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        long start = System.currentTimeMillis();
        int b;
        while ((b=bis.read())!=-1){
            bos.write(b);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕!耗时："+(end-start)+"ms");
        bis.close();
        bos.close();
         */

    }
}
